By now, there is nothing special here. Of course you may play with it and figure that parts of the datastructure can be collapsed. However that is not what I dreamt about. One of the ideas I wanted to play with was having structured data in shell piplines. Here is where the ideas cross - lisp is a natural choice to represent such kind of data. So I started with filesystem module.
| Size | Modified | Name | |
|---|---|---|---|
| 4K | May 5 12:01 | css | |
| 602 | Apr 30 17:18 | fat.html | |
| 616 | Apr 30 17:03 | index.html | |
| 533 | Apr 30 17:04 | slim.html | |
| 151 | Apr 25 2022 | test.html |
Hey, what has just happened? This doesn't look like a clojure data structure!
Here they are - our clojure data structures.
The magic is caused by the special metadata attached to our clojure data representing these files. Metadata activates custom client side code which may render data returned by a function in a special way. In this case we have specialized renderer for files. (See fs.cljs module for example). There are also some generic renderers such as :table or :html, check it out.
| Name | Age |
|---|---|
| Giuseppe | 23 |
| Василий | 42 |
| Ὅμηρος | :undefined |
There are convenience functions such as table which add appropriate metadata
| Size | Modified | Name | |
|---|---|---|---|
| 2.4K | May 1 09:08 | deps.edn | |
| 521 | Apr 29 14:03 | dev.cljs.edn | |
| 583 | May 1 07:30 | fat.cljs.edn | |
| 1.2K | Feb 17 08:46 | figwheel-main.edn | |
| 121 | Apr 30 17:04 | slim.cljs.edn | |
| 460 | Jun 22 17:41 | test.cljs.edn |
| Name | |
|---|---|
| doc/doc.clj | |
| extra/src/shashurup/quf/theme.clj | |
| extra/src/shashurup/quf/data.clj | |
| extra/src/shashurup/quf/fs.clj | |
| extra/src/shashurup/quf/sh.clj | |
| extra/src/shashurup/quf/base16.clj | |
| extra/src/shashurup/quf/geo.clj | |
| extra/src/shashurup/quf/chart.clj | |
| extra/src/shashurup/quf/secrets.clj | |
| extra/src/shashurup/quf/db.clj | |
| src/shashurup/quf/ui.clj | |
| src/shashurup/quf/vars.clj | |
| src/shashurup/quf/response.clj | |
| src/shashurup/quf/srv.clj | |
| build.clj | |
| target/slim-jar/shashurup/quf/vars.clj | |
| target/slim-jar/shashurup/quf/response.clj | |
| target/slim-jar/shashurup/quf/srv.clj |
| Size | Modified | Name | |
|---|---|---|---|
| 4K | Feb 4 09:10 | base16 | |
| 4K | May 9 10:58 | doc | |
| 4K | Apr 29 13:23 | extra | |
| 4K | Apr 29 13:27 | resources | |
| 4K | Jun 22 17:35 | src | |
| 4K | May 1 09:35 | target | |
| 4K | Jun 22 17:36 | test | |
| 2.4K | May 1 09:37 | build.clj | |
| 2.4K | May 1 09:08 | deps.edn | |
| 521 | Apr 29 14:03 | dev.cljs.edn | |
| 1.1K | May 9 12:38 | dummy-auto-testing.js | |
| 583 | May 1 07:30 | fat.cljs.edn | |
| 1.2K | Feb 17 08:46 | figwheel-main.edn | |
| 171 | Apr 29 13:30 | install-xterm.js.sh | |
| 25K | Mar 24 18:18 | package-lock.json | |
| 89 | Mar 23 17:53 | package.json | |
| 5.1K | May 5 17:03 | project.org | |
| 2.8K | May 1 09:15 | README.md | |
| 121 | Apr 30 17:04 | slim.cljs.edn | |
| 460 | Jun 22 17:41 | test.cljs.edn | |
| 476 | Jan 8 10:15 | test.py |
$$s is so called client side variable. It is evaluated before an expression is sent to backend for evaluation. $$s is for the nearest cell with checkboxes (they appear when you press Ctrl+m), $$s-all is for all checkboxes on the page etc.These variables are controlled by client side code and cannot be assigned.
This detects file type and parses it accordingly. XML and CSV are also supported.
:c makes output to appear as a list of thumbnails. (Ctrl+m also works here)
^{:watch-dirs ["test" "src" "extra/src"]
:css-dirs ["resources/public/css"
"extra/resources/public/css"]
:auto-testing true}
{:modules {:core {:entries #{shashurup.quf.core}}
:fs {:entries #{shashurup.quf.fs}}
:chartjs {:entries #{shashurup.quf.chartjs}}
:ol {:entries #{shashurup.quf.ol}}
:terminal {:entries #{shashurup.quf.terminal}}
:theme {:entries #{shashurup.quf.theme}}
}
:output-to "dummy.js"
:externs ["xtermjs-externs.js"]
}Escape sequences are handled via xterm.js. And, yes, you can run Vim here.
It was a bit hard to resist temptation to plug jdbc infrastructure
WARNING: random-uuid already refers to: #'clojure.core/random-uuid in namespace: monger.util, being replaced by: #'monger.util/random-uuid
| id | name | country_id |
|---|---|---|
| 1 | Sukhumi | 68 |
| 2 | Kabul | 31 |
| 3 | Mariehamn | 142 |
| 4 | Tirana | 4 |
| 5 | Algiers | 2 |
| 7 | Andorra la Vella | 188 |
| 8 | Luanda | 6 |
| 9 | The Valley | 128 |
| 11 | St. Johns | 1 |
| 12 | Buenos Aires | 8 |
| id | name |
|---|---|
| 1 | Antigua and Barbuda |
| 2 | Algeria |
| 3 | Azerbaijan |
| 4 | Albania |
| 5 | Armenia |
| 6 | Angola |
| 7 | American Samoa |
| id | name |
|---|---|
| 219 | Wallis and Futuna Islands |
| 237 | Western Sahara |
There is a collection of base16 themes, use ls to browse, click to apply, enjoy!